This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
The information is available using the JSF APIs.
The component corresponding to an edit box is a javax.faces.UIInput
(same applies to a combo box or any other field that inputs a field value).
During the validation, if the field is not valid, UIInput.isValid will be set to false.
Also during validation, FacesMessage objects are added to the facesContext
for each control that fails validation. If the control has multiple validators that fail,
then multiple messages will be added.
For example:
Paste this source into an XPage and Preview. If you click the submit button without entering a value
in the edit box, then the computed fields will display the error messages.
The messages associated with inputText1:
<xp:br></xp:br>
<xp:text escape="false" id="computedField1">
<xp:this.value><![CDATA[#{javascript:
var input:javax.faces.component.UIInput = getComponent('inputText1');
if( input.isValid() ){
// no message
return "";
}
var clientId = input.getClientId(facesContext);
// the messages for that input
var messagesIter:Iterator = facesContext.getMessages(clientId);
var result = "";
while( messagesIter.hasNext() ){
var messageObj:javax.faces.application.FacesMessage
= messagesIter.next();
result += messageObj.getSummary()+ "<br/>";
}
return result;}]]></xp:this.value>
</xp:text>
<xp:br></xp:br>
<xp:br></xp:br>
All messages:
<xp:br></xp:br><xp:text escape="false" id="computedField2">
<xp:this.value><![CDATA[#{javascript:
// all messages
var messagesIter:Iterator = facesContext.getMessages();
var result = "";
while( messagesIter.hasNext() ){
var messageObj:javax.faces.application.FacesMessage
= messagesIter.next();
result += messageObj.getSummary() + "<br/>";
}
return result;}]]></xp:this.value>
</xp:text>
</xp:view>
Hope that helps.
Feedback response number MKEE7NWDPW created by ~Lex Feztookonyikle on 02/03/2009